#include "StdAfx.h"
#include "MyThread.h"


static unsigned int __stdcall ThreadProc(void* pParam)
{
	CMyThread* pThis = (CMyThread*)pParam;
	pThis->Run();

	return 0;
}

CMyThread::CMyThread(void)
{
}

CMyThread::~CMyThread(void)
{
}

void CMyThread::Run()
{

	m_pCustomer->ThreadProc();
	
	_endthreadex(0);
}

bool CMyThread::Init(void *pParam)
{
	if (pParam == NULL)
		return false;

	m_pCustomer = (InterfaceThread*)pParam;
	unsigned threadid = 0;

	HANDLE hThread = (HANDLE)_beginthreadex(NULL, 0, &ThreadProc, (LPVOID)this, 0, &threadid);
	if (hThread == NULL)
		return false;

	return true;
}
